package com.wjerp.tplus.server.common.constant;

/**
 * 发票校验信息返回接口状态枚举
 * @author lishuailei
 */
public enum VerInvoiceSearchResult {
    SUCCESS("10000","查询成功"),
    ERROR_APP_KEY("10001","错误的请求appkey"),
    INTERFACE_EXCEPTION("11010","商家接口调用异常，请稍后再试"),
    INTERFACE_FORM_ERROR("11030","商家接口返回格式有误"),
    NOT_EXIST_DATA("10003","不存在相应的数据信息"),
    APP_KEY_IS_EMPTY("10004","URL上appkey参数不能为空"),
    RECHARGE("10010","接口需要付费，请充值"),
    SYSTEM_ERROR("10020","万象系统繁忙，请稍后再试"),
    GATEWAY_ERROR("10030","调用万象网关失败， 请与万象联系"),
    OVER_LIMIT("10040",	"超过每天限量，请明天继续"),
    DISABLE_USER("10050",	"用户已被禁用"),
    UN_PERMISSION("10060"	,"提供方设置调用权限，请联系提供方"),
    ONLY_COMPANY_USER("10070","该数据只允许企业用户调用"),
    FILE_SIZE_OVER_LIMIT("10090","文件大小超限，请上传小于1M的文件");

    private String code;
    private String message;

    public String getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }


    /**
     * Instantiates a new error detail.
     *
     * @param code the code
     * @param message the message
     */
    private VerInvoiceSearchResult(String code, String message) {
        this.code = code;
        this.message = message;
    }

    public static VerInvoiceSearchResult resolve(String code) {
        for (VerInvoiceSearchResult item : values()) {
            if (item.getCode().equalsIgnoreCase(code)) {
                return item;
            }
        }
        return null;
    }

}
